package com.blb.dao.admin;

import com.blb.pojo.Product;

import java.sql.SQLException;
import java.util.List;

public interface ProductDao {

    /**
     * 根据商品名称获取商品信息
     * @param name
     * @return
     */
    Product selectByName(String name) throws Exception;

    /**
     * 根据商品名称分页
     * @param page
     * @param size
     * @param name
     * @return
     */
    List<Product> selectPageByName(int page, int size, String name) throws Exception;

    /**
     * 根据商品名称查询总条数
     * @param name
     * @return
     */
    int count(String name) throws SQLException, ClassNotFoundException;

    /**
     * 插入
     * @param product
     */
    void insert(Product product) throws SQLException, ClassNotFoundException;

    /**
     * 根据id删除
     * @param id
     */
    void deleteById(int id) throws SQLException, ClassNotFoundException;

    /**
     * 批量删除
     * @param ids
     */
    void batchDelete(String[] ids) throws SQLException, ClassNotFoundException;

    /**
     * 根据id查询商品信息
     * @param id
     * @return
     */
    Product selectById(int id) throws Exception;

    /**
     * 修改商品
     * @param product
     */
    void update(Product product) throws SQLException, ClassNotFoundException;

    /**
     * 根据id改变状态
     * @param id
     * @param status
     */
    void updateStatusById(int id, int status) throws SQLException, ClassNotFoundException;
}
